Return type | Name and parameters |
---|---|
boolean
|
asBoolean()
Coerces a byte array to a boolean value. |
boolean
|
contains(Object value)
Checks whether the array contains the given value. |
Number
|
count(Object value)
Counts the number of occurrences of the given value inside this array. |
void
|
eachByte(Closure closure)
Traverse through each byte of this byte array. |
Writable
|
encodeBase64(boolean chunked)
Produce a Writable object which writes the Base64 encoding of the byte array. |
Writable
|
encodeBase64()
Produce a Writable object which writes the Base64 encoding of the byte array. |
Writable
|
encodeHex()
Produces a Writable that writes the hex encoding of the byte[]. |
Collection
|
flatten()
Flatten an array. |
List
|
getAt(Range range)
Support the subscript operator with a range for a byte array |
List
|
getAt(IntRange range)
Support the subscript operator with an IntRange for a byte array |
List
|
getAt(ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array |
List
|
getAt(Collection indices)
Support the subscript operator with a collection for a byte array |
int
|
size()
Allows arrays to behave similar to collections. |
List
|
toList()
Converts this array to a List of the same size, with each element added to the list. |
Set
|
toSet()
Converts this array to a Set, with each unique element added to the set. |
String
|
toString()
Returns the string representation of the given array. |
Coerces a byte array to a boolean value. A byte array is false if the array is of length 0, and true otherwise.
Checks whether the array contains the given value.
value
- the value being searched for.Counts the number of occurrences of the given value inside this array.
Comparison is done using Groovy's == operator (using
compareTo(value) == 0
or equals(value)
).
value
- the value being searched for.Traverse through each byte of this byte array. Alias for each.
closure
- a closure.Produce a Writable object which writes the Base64 encoding of the byte array.
Calling toString() on the result returns the encoding as a String. For more
information on Base64 encoding and chunking see RFC 4648
.
chunked
- whether or not the Base64 encoded data should be MIME chunked.Produce a Writable object which writes the Base64 encoding of the byte array.
Calling toString() on the result returns the encoding as a String. For more
information on Base64 encoding and chunking see RFC 4648
.
Produces a Writable that writes the hex encoding of the byte[]. Calling toString() on this Writable returns the hex encoding as a String. The hex encoding includes two characters for each byte and all letters are lower case.
Flatten an array. This array and any nested arrays or collections have their contents (recursively) added to the new collection.
Support the subscript operator with a range for a byte array
range
- a range indicating the indices for the items to retrieve.Support the subscript operator with an IntRange for a byte array
range
- an IntRange indicating the indices for the items to retrieve.Support the subscript operator with an ObjectRange for a byte array
range
- an ObjectRange indicating the indices for the items to retrieve.Support the subscript operator with a collection for a byte array
indices
- a collection of indices for the items to retrieve.Allows arrays to behave similar to collections.
Converts this array to a List of the same size, with each element added to the list.
Converts this array to a Set, with each unique element added to the set.
Returns the string representation of the given array.